﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

//public partial class SceneDataMgr : MonoBehaviour
//{
//    private static SceneDataMgr instance;
//    private static GameObject container;
//    public static SceneDataMgr GetInstance()
//    {
//        if (!instance)
//        {
//            container = new GameObject();
//            container.name = "SceneDataMgr";
//            instance = container.AddComponent(typeof(SceneDataMgr)) as SceneDataMgr;
//        }
//        return instance;
//    }
//}

public class SceneDataMgr : MonoBehaviour
{

    public int g_iMoney;

    public float m_fChaos = 0;    // Game Chaos
    public int m_iScore = 10;    //Game Score

	public List<UnitStatus> UnitList = new List<UnitStatus> ();  //Unit of current scene
    public List<GameObject> StructQueue = new List<GameObject>(); // 건설대기중인 건물 큐
    public List<WeaponData> ArmoryWeaponList = new List<WeaponData>(); // 무기고에 가지고있는 무기리스트
    public List<AmmoBox> AmmoDumpList = new List<AmmoBox>();
    public List<UnitStatus> GraveList = new List<UnitStatus>(); // 시체 리스트

    public GameObject SelectedUnit;

    public List<GameObject> GoneToMissionUnitList = new List<GameObject>(); // 임무보낸 유닛들

    public WeaponData SupplyWeaponQueue;

    bool m_bPlayOnce;
    void Awake()
    {
        DontDestroyOnLoad(transform.gameObject);
    }

    public void Start()
    {
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.RIFLE, "AK47"));
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.RIFLE, "AK47"));
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.RIFLE, "AK47"));
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.PISTOL, "Tokarev"));
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.PISTOL, "Tokarev"));
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.CLOSE, "Shield"));
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.RIFLE, "Bizon PP-19"));
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.RIFLE, "FN FAL"));
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.RIFLE, "PKM"));
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.RIFLE, "SVD"));
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.RIFLE, "Vintorez"));
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.RIFLE, "FN303"));
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.RIFLE, "FN303"));
        ArmoryWeaponList.Add(GameObject.Find("DataLogic").GetComponent<DataManager>().Get_WeaponData_List(WEAPON_TYPE.RIFLE, "FN303"));

        g_iMoney = 10000;
    }

    void Update()
    {
        if (m_fChaos > 5 &&  !m_bPlayOnce)
        {
            //Handheld.PlayFullScreenMovie("Video/AA.avi", Color.black, FullScreenMovieControlMode.CancelOnInput);
            //m_bPlayOnce = true;
        }
    }
}
